This sample serves two purposes: it contains a sample code library that simplifies access to the STREAMS "sad" (autopush) driver, and it includes a program that you can use to establish arbitrary autopushes for testing purposes.
This sample requires some form of Open Transport. Only a PowerPC build is provided, although the concepts are supported on 68K versions of OT.
Packing List
The sample contains the following items:
• Read Me About MoreAutoPush — This document.
• MoreSetup.h — This sample was projected out of the DTS sample code library MoreIsBetter. This setup file is common to all MIB modules and is required to build the sample.
• MoreAutoPush.h — The interface to the autopush library.
• MoreAutoPush.c — The implementation of the autopush library.
• MoreAutoPushTest — This folder contains the source and compiled binary (MoreAutoPushTest-PPC) of a program to test the autopush library. This program is also a useful utility for autopush testing in general.
Using the Sample
To run the “MoreAutoPushTest-PPC” application, simply launch it from the Finder. The application prints a list of possible commands. Enter a command to execute it. For example, to autopush the "StreamNOP" module on top of the "serial1" driver, enter the "p" command and follow the onscreen instructions.
Note: StreamNOP is a "no operation" STREAMS module that is available from the DTS sample code web site.
To use the library in your own code, simply add the “MoreAutoPush.c” file to your project and include the “MoreAutoPush.h” header. The header includes documentation on each of the routines. There is more documentation in “Open Transport Advanced Client Programming” (see below).
Building the Sample
This sample was built using the CodeWarrior Pro 2 C compiler, upgrade to Universal Interfaces 3.3.2. There should be no problem building the project using a modern CodeWarrior compiler. Just open the “MoreAutoPushTest.mcp” project, select the “PPC” target, and choose Make from the Project menu.
How it Works
The STREAMS autopush driver ("sad") is described in detail in “Open Transport Advanced Client Programming”. This code was developed as part of writing that book. See chapter 8 of that book for more details on this library.